package com.eastfair.venueservice.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.eastfair.database.mybatis.typehandler.M9EncryptHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;
import com.eastfair.venueservice.enumeration.WorkOvertimeWorkOvertimeTypeEnum;
import com.eastfair.venueservice.enumeration.WorkOvertimeWorkOvertimeSourceEnum;
import org.springframework.format.annotation.DateTimeFormat;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 加班申请
 * </p>
 *
 * @author dqq
 * @since 2023-05-12
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName(value="vsm_work_overtime",autoResultMap = true)
@ApiModel(value = "WorkOvertime", description = "加班申请")
@AllArgsConstructor
public class WorkOvertime extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 是否启用（确认状态）：1是 已确认；0否 未确认
     */
    @ApiModelProperty(value = "是否启用（确认状态）：1是 已确认；0否 未确认")
    @TableField(value = "is_enabled")
    @Excel(name = "是否启用（确认状态）：1是 已确认；0否 未确认")
    private Integer isEnabled;

    /**
     * 是否删除：1是；0否
     */
    @ApiModelProperty(value = "是否删除：1是；0否")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除：1是；0否")
    private Integer isDeleted;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @TableField(value = "project_id")
    @Excel(name = "项目id")
    private Long projectId;

    /**
     * 子系统id
     */
    @ApiModelProperty(value = "子系统id")
    @TableField(value = "subsystem_id")
    @Excel(name = "子系统id")
    private Long subsystemId;

    /**
     * 租户id
     */
    @ApiModelProperty(value = "租户id")
    @TableField(value = "tenant_id")
    @Excel(name = "租户id")
    private Long tenantId;

    /**
     * 加班单号
     */
    @ApiModelProperty(value = "加班单号")
    @Size(max = 64, message = "加班单号长度不能超过64")
    @TableField(value = "work_overtime_number", condition = LIKE)
    @Excel(name = "加班单号")
    private String workOvertimeNumber;

    /**
     * 服务商系统加班单号
     */
    @ApiModelProperty(value = "服务商系统加班单号")
    @Size(max = 64, message = "服务商系统加班单号长度不能超过64")
    @TableField(value = "sp_work_overtime_number", condition = LIKE)
    @Excel(name = "服务商系统加班单号")
    private String spWorkOvertimeNumber;

    /**
     * 订单号
     */
    @ApiModelProperty(value = "订单号")
    @Size(max = 64, message = "订单号长度不能超过64")
    @TableField(value = "order_number", condition = LIKE)
    @Excel(name = "订单号")
    private String orderNumber;

    /**
     * 加班申请来源 #{ONLINE_BOOK:线上预定;ON_SITE_ORDER:现场预定}
     */
    @ApiModelProperty(value = "加班申请来源 #{ONLINE_BOOK:线上预定;ON_SITE_ORDER:现场预定}")
    @TableField(value = "work_overtime_source")
    @Excel(name = "加班申请来源 #{ONLINE_BOOK:线上预定;ON_SITE_ORDER:现场预定}", replace = {"线上预定_ONLINE_BOOK", "现场预定_ON_SITE_ORDER",  "_null"})
    private WorkOvertimeWorkOvertimeSourceEnum workOvertimeSource;

    /**
     * 加班规格名称
     */
    @ApiModelProperty(value = "加班规格名称")
    @Size(max = 100, message = "加班规格名称长度不能超过100")
    @TableField(value = "spec_name", condition = LIKE)
    @Excel(name = "加班规格名称")
    private String specName;

    /**
     * 加班规则类型
     */
    @ApiModelProperty(value = "加班规则类型")
    @Size(max = 64, message = "加班规则类型长度不能超过64")
    @TableField(value = "rule_type", condition = LIKE)
    @Excel(name = "加班规则类型")
    private String ruleType;

    /**
     * 展会ID
     */
    @ApiModelProperty(value = "展会ID")
    @TableField(value = "exhibition_manage_id")
    @Excel(name = "展会ID")
    private Long exhibitionManageId;

    /**
     * 展会名称
     */
    @ApiModelProperty(value = "展会名称")
    @Size(max = 200, message = "展会名称长度不能超过200")
    @TableField(value = "exhibition_manage_name", condition = LIKE)
    @Excel(name = "展会名称")
    private String exhibitionManageName;

    /**
     * 公司ID
     */
    @ApiModelProperty(value = "公司ID")
    @TableField(value = "company_id")
    @Excel(name = "公司ID")
    private Long companyId;

    /**
     * 公司编码
     */
    @ApiModelProperty(value = "公司编码")
    @Size(max = 64, message = "公司编码长度不能超过64")
    @TableField(value = "company_code", condition = LIKE)
    @Excel(name = "公司编码")
    private String companyCode;

    /**
     * 公司名称
     */
    @ApiModelProperty(value = "公司名称")
    @Size(max = 200, message = "公司名称长度不能超过200")
    @TableField(value = "company_name", condition = LIKE)
    @Excel(name = "公司名称")
    private String companyName;

    /**
     * 公司类型
     */
    @ApiModelProperty(value = "公司类型")
    @Size(max = 64, message = "公司类型长度不能超过64")
    @TableField(value = "company_type", condition = LIKE)
    @Excel(name = "公司类型")
    private String companyType;

    /**
     * 主场ID
     */
    @ApiModelProperty(value = "主场ID")
    @TableField(value = "home_id")
    @Excel(name = "主场ID")
    private Long homeId;

    /**
     * 主场名称
     */
    @ApiModelProperty(value = "主场名称")
    @Size(max = 200, message = "主场名称长度不能超过200")
    @TableField(value = "home_name", condition = LIKE)
    @Excel(name = "主场名称")
    private String homeName;

    /**
     * 联系人
     */
    @ApiModelProperty(value = "联系人")
    @Size(max = 100, message = "联系人长度不能超过100")
    @TableField(value = "contact", condition = LIKE)
    @Excel(name = "联系人")
    private String contact;

    /**
     * 联系方式
     */
    @ApiModelProperty(value = "联系方式")
    @Size(max = 100, message = "联系方式长度不能超过100")
    @TableField(value = "phone", condition = LIKE,typeHandler = M9EncryptHandler.class)
    @Excel(name = "联系方式")
    private String phone;

    /**
     * 展厅编码
     */
    @ApiModelProperty(value = "展厅编码")
    @Size(max = 64, message = "展厅编码长度不能超过64")
    @TableField(value = "space_code", condition = LIKE)
    @Excel(name = "展厅编码")
    private String spaceCode;

    /**
     * 展厅号
     */
    @ApiModelProperty(value = "展厅号")
    @Size(max = 100, message = "展厅号长度不能超过100")
    @TableField(value = "space_name", condition = LIKE)
    @Excel(name = "展厅号")
    private String spaceName;

    /**
     * 展位号
     */
    @ApiModelProperty(value = "展位号")
    @Size(max = 100, message = "展位号长度不能超过100")
    @TableField(value = "site_name", condition = LIKE)
    @Excel(name = "展位号")
    private String siteName;

    /**
     * 展位面积
     */
    @ApiModelProperty(value = "展位面积")
    @TableField(value = "site_area")
    @Excel(name = "展位面积")
    private BigDecimal siteArea;

    /**
     * 加班面积
     */
    @ApiModelProperty(value = "加班面积")
    @TableField(value = "overtime_area")
    @Excel(name = "加班面积")
    private BigDecimal overtimeArea;

    /**
     * 加班日期
     */
    @ApiModelProperty(value = "加班日期")
    @TableField(value = "overtime_date")
    @Excel(name = "加班日期", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDate overtimeDate;

    /**
     * 申请时间
     */
    @ApiModelProperty(value = "申请时间")
    @TableField(value = "report_time")
    @Excel(name = "申请时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime reportTime;

    /**
     * 计时单位
     */
    @ApiModelProperty(value = "计时单位")
    @TableField(value = "time_unit")
    @Excel(name = "计时单位")
    private Integer timeUnit;

    /**
     * 加班开始时间
     */
    @ApiModelProperty(value = "加班开始时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm")
    @DateTimeFormat(pattern = "HH:mm")
    @TableField(value = "overtime_start")
    @Excel(name = "加班开始时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalTime overtimeStart;

    /**
     * 加班结束时间
     */
    @ApiModelProperty(value = "加班结束时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm")
    @DateTimeFormat(pattern = "HH:mm")
    @TableField(value = "overtime_end")
    @Excel(name = "加班结束时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalTime overtimeEnd;

    /**
     * 时段1开始时间
     */
    @ApiModelProperty(value = "时段1开始时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm")
    @DateTimeFormat(pattern = "HH:mm")
    @TableField(value = "period_one_begin")
    @Excel(name = "时段1开始时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalTime periodOneBegin;

    /**
     * 时段1开始时间
     */
    @ApiModelProperty(value = "时段1开始时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm")
    @DateTimeFormat(pattern = "HH:mm")
    @TableField(value = "period_one_end")
    @Excel(name = "时段1开始时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalTime periodOneEnd;

    /**
     * 时段2开始时间
     */
    @ApiModelProperty(value = "时段2开始时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm")
    @DateTimeFormat(pattern = "HH:mm")
    @TableField(value = "period_two_begin")
    @Excel(name = "时段2开始时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalTime periodTwoBegin;

    /**
     * 时段2开始时间
     */
    @ApiModelProperty(value = "时段2开始时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm")
    @DateTimeFormat(pattern = "HH:mm")
    @TableField(value = "period_two_end")
    @Excel(name = "时段2开始时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalTime periodTwoEnd;

    /**
     * 申请加班时长(小时)
     */
    @ApiModelProperty(value = "申请加班时长(小时)")
    @TableField(value = "report_overtime_period")
    @Excel(name = "申请加班时长(小时)")
    private Double reportOvertimePeriod;

    /**
     * 时段1时长
     */
    @ApiModelProperty(value = "时段1时长")
    @TableField(value = "period_one")
    @Excel(name = "时段1时长")
    private Double periodOne;

    /**
     * 时段2时长
     */
    @ApiModelProperty(value = "时段2时长")
    @TableField(value = "period_two")
    @Excel(name = "时段2时长")
    private Double periodTwo;

    /**
     * 实际离场时间
     */
    @ApiModelProperty(value = "实际离场时间")
    @TableField(value = "actual_depart_time")
    @Excel(name = "实际离场时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime actualDepartTime;

    /**
     * 实际加班时长(小时)
     */
    @ApiModelProperty(value = "实际加班时长(小时)")
    @TableField(value = "actual_overtime_period")
    @Excel(name = "实际加班时长(小时)")
    private Double actualOvertimePeriod;

    /**
     * 时段1单价
     */
    @ApiModelProperty(value = "时段1单价")
    @TableField(value = "period_one_price")
    @Excel(name = "时段1单价")
    private BigDecimal periodOnePrice;

    /**
     * 时段2单价
     */
    @ApiModelProperty(value = "时段2单价")
    @TableField(value = "period_two_price")
    @Excel(name = "时段2单价")
    private BigDecimal periodTwoPrice;

    /**
     * 加班计费金额
     */
    @ApiModelProperty(value = "加班计费金额")
    @TableField(value = "overtime_amount")
    @Excel(name = "加班计费金额")
    private BigDecimal overtimeAmount;

    /**
     * 超时金额
     */
    @ApiModelProperty(value = "超时金额")
    @TableField(value = "overtime_extra_amount")
    @Excel(name = "超时金额")
    private BigDecimal overtimeExtraAmount;

    /**
     * 超时加急费用
     */
    @ApiModelProperty(value = "超时加急费用")
    @TableField(value = "overtime_surcharge")
    @Excel(name = "超时加急费用")
    private BigDecimal overtimeSurcharge;

    /**
     * 应付总金额
     */
    @ApiModelProperty(value = "应付总金额")
    @TableField(value = "should_pay_amount")
    @Excel(name = "应付总金额")
    private BigDecimal shouldPayAmount;

    /**
     * 实际支付金额
     */
    @ApiModelProperty(value = "实际支付金额")
    @TableField(value = "actual_pay_amount")
    @Excel(name = "实际支付金额")
    private BigDecimal actualPayAmount;

    /**
     * 利润率
     */
    @ApiModelProperty(value = "利润率")
    @TableField(value = "profit_rate")
    @Excel(name = "利润率")
    private BigDecimal profitRate;

    /**
     * 支付方式
     */
    @ApiModelProperty(value = "支付方式")
    @Size(max = 64, message = "支付方式长度不能超过64")
    @TableField(value = "pay_way", condition = LIKE)
    @Excel(name = "支付方式")
    private String payWay;

    /**
     * 支付时间
     */
    @ApiModelProperty(value = "支付时间")
    @TableField(value = "pay_time")
    @Excel(name = "支付时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime payTime;

    /**
     * 支付状态
     */
    @ApiModelProperty(value = "支付状态")
    @Size(max = 64, message = "支付状态长度不能超过64")
    @TableField(value = "pay_status", condition = LIKE)
    @Excel(name = "支付状态")
    private String payStatus;

    /**
     * 派工状态
     */
    @ApiModelProperty(value = "派工状态")
    @Size(max = 64, message = "派工状态长度不能超过64")
    @TableField(value = "work_order_status", condition = LIKE)
    @Excel(name = "派工状态")
    private String workOrderStatus;

    /**
     * 加班类型 #{WORK_OVERTIME_TYPE:加班类型;ADVANCE_APPROACH:提前入场申请;LOAD_UPLOAD_SERVICE:装卸服务申请}
     */
    @ApiModelProperty(value = "加班类型 #{WORK_OVERTIME_TYPE:加班类型;ADVANCE_APPROACH:提前入场申请;LOAD_UPLOAD_SERVICE:装卸服务申请}")
    @TableField(value = "work_overtime_type")
    @Excel(name = "加班类型 #{WORK_OVERTIME_TYPE:加班类型;ADVANCE_APPROACH:提前入场申请;LOAD_UPLOAD_SERVICE:装卸服务申请}", replace = {"加班类型_WORK_OVERTIME_TYPE", "提前入场申请_ADVANCE_APPROACH", "装卸服务申请_LOAD_UPLOAD_SERVICE",  "_null"})
    private WorkOvertimeWorkOvertimeTypeEnum workOvertimeType;

    /**
     * 审核状态 (SUBMIT:待审核;APPROVED:审核通过;NOT_APPROVED:审核未通过;CANCEL:取消申请)
     */
    @ApiModelProperty(value = "审核状态 (SUBMIT:待审核;APPROVED:审核通过;NOT_APPROVED:审核未通过;CANCEL:取消申请)")
    @Size(max = 64, message = "审核状态 (SUBMIT:待审核;APPROVED:审核通过;NOT_APPROVED:审核未通过;CANCEL:取消申请)长度不能超过64")
    @TableField(value = "audit_status", condition = LIKE)
    @Excel(name = "审核状态 (SUBMIT:待审核;APPROVED:审核通过;NOT_APPROVED:审核未通过;CANCEL:取消申请)")
    private String auditStatus;

    /**
     * 审核意见
     */
    @ApiModelProperty(value = "审核意见")
    @Size(max = 200, message = "审核意见长度不能超过200")
    @TableField(value = "audit_opinion", condition = LIKE)
    @Excel(name = "审核意见")
    private String auditOpinion;

    /**
     * 审核时间
     */
    @ApiModelProperty(value = "审核时间")
    @TableField(value = "audit_time")
    @Excel(name = "审核时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime auditTime;

    /**
     * 审核人ID
     */
    @ApiModelProperty(value = "审核人ID")
    @TableField(value = "audit_user_id")
    @Excel(name = "审核人ID")
    private Long auditUserId;

    /**
     * 审核人姓名
     */
    @ApiModelProperty(value = "审核人姓名")
    @Size(max = 64, message = "审核人姓名长度不能超过64")
    @TableField(value = "audit_user_name", condition = LIKE)
    @Excel(name = "审核人姓名")
    private String auditUserName;

    /**
     * 所属系统
     */
    @ApiModelProperty(value = "所属系统")
    @Size(max = 64, message = "所属系统长度不能超过64")
    @TableField(value = "belong_system", condition = LIKE)
    @Excel(name = "所属系统")
    private String belongSystem;

    /**
     * 备注信息
     */
    @ApiModelProperty(value = "备注信息")
    @Size(max = 500, message = "备注信息长度不能超过500")
    @TableField(value = "remark", condition = LIKE)
    @Excel(name = "备注信息")
    private String remark;


    @Builder
    public WorkOvertime(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    Integer isEnabled, Integer isDeleted, Long projectId, Long subsystemId, Long tenantId, 
                    String workOvertimeNumber, String spWorkOvertimeNumber, String orderNumber, WorkOvertimeWorkOvertimeSourceEnum workOvertimeSource, String specName, String ruleType, 
                    Long exhibitionManageId, String exhibitionManageName, Long companyId, String companyCode, String companyName, String companyType, 
                    Long homeId, String homeName, String contact, String phone, String spaceCode, String spaceName, 
                    String siteName, BigDecimal siteArea, BigDecimal overtimeArea, LocalDate overtimeDate, LocalDateTime reportTime, Integer timeUnit, 
                    LocalTime overtimeStart, LocalTime overtimeEnd, LocalTime periodOneBegin, LocalTime periodOneEnd, LocalTime periodTwoBegin, LocalTime periodTwoEnd, 
                    Double reportOvertimePeriod, Double periodOne, Double periodTwo, LocalDateTime actualDepartTime, Double actualOvertimePeriod, BigDecimal periodOnePrice, 
                    BigDecimal periodTwoPrice, BigDecimal overtimeAmount, BigDecimal overtimeExtraAmount, BigDecimal overtimeSurcharge, BigDecimal shouldPayAmount, BigDecimal actualPayAmount, 
                    BigDecimal profitRate, String payWay, LocalDateTime payTime, String payStatus, String workOrderStatus, WorkOvertimeWorkOvertimeTypeEnum workOvertimeType, 
                    String auditStatus, String auditOpinion, LocalDateTime auditTime, Long auditUserId, String auditUserName, String belongSystem, String remark) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
        this.projectId = projectId;
        this.subsystemId = subsystemId;
        this.tenantId = tenantId;
        this.workOvertimeNumber = workOvertimeNumber;
        this.spWorkOvertimeNumber = spWorkOvertimeNumber;
        this.orderNumber = orderNumber;
        this.workOvertimeSource = workOvertimeSource;
        this.specName = specName;
        this.ruleType = ruleType;
        this.exhibitionManageId = exhibitionManageId;
        this.exhibitionManageName = exhibitionManageName;
        this.companyId = companyId;
        this.companyCode = companyCode;
        this.companyName = companyName;
        this.companyType = companyType;
        this.homeId = homeId;
        this.homeName = homeName;
        this.contact = contact;
        this.phone = phone;
        this.spaceCode = spaceCode;
        this.spaceName = spaceName;
        this.siteName = siteName;
        this.siteArea = siteArea;
        this.overtimeArea = overtimeArea;
        this.overtimeDate = overtimeDate;
        this.reportTime = reportTime;
        this.timeUnit = timeUnit;
        this.overtimeStart = overtimeStart;
        this.overtimeEnd = overtimeEnd;
        this.periodOneBegin = periodOneBegin;
        this.periodOneEnd = periodOneEnd;
        this.periodTwoBegin = periodTwoBegin;
        this.periodTwoEnd = periodTwoEnd;
        this.reportOvertimePeriod = reportOvertimePeriod;
        this.periodOne = periodOne;
        this.periodTwo = periodTwo;
        this.actualDepartTime = actualDepartTime;
        this.actualOvertimePeriod = actualOvertimePeriod;
        this.periodOnePrice = periodOnePrice;
        this.periodTwoPrice = periodTwoPrice;
        this.overtimeAmount = overtimeAmount;
        this.overtimeExtraAmount = overtimeExtraAmount;
        this.overtimeSurcharge = overtimeSurcharge;
        this.shouldPayAmount = shouldPayAmount;
        this.actualPayAmount = actualPayAmount;
        this.profitRate = profitRate;
        this.payWay = payWay;
        this.payTime = payTime;
        this.payStatus = payStatus;
        this.workOrderStatus = workOrderStatus;
        this.workOvertimeType = workOvertimeType;
        this.auditStatus = auditStatus;
        this.auditOpinion = auditOpinion;
        this.auditTime = auditTime;
        this.auditUserId = auditUserId;
        this.auditUserName = auditUserName;
        this.belongSystem = belongSystem;
        this.remark = remark;
    }

}
